home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 276-300 / disk_280 / graph / uio.h < prev   
C/C++ Source or Header  |  1992-05-06  |  3KB  |  103 lines

  1. /*
  2.  *                 GRAPH, Version 1.00 - 4 August 1989
  3.  *
  4.  *            Copyright 1989, David Gay. All Rights Reserved.
  5.  *            This software is freely redistrubatable.
  6.  */
  7.  
  8. /* User interface routines (windows, menus, requesters, etc) */
  9. #ifndef UIO_H
  10. #define UIO_H
  11.  
  12. #include "list.h"
  13.  
  14. #define FONTLEN 30 /* font name length */
  15. #define NBLEN 25
  16. #define INTLEN 11
  17.  
  18. /* A gadget handler routine, called for every gadget event when a requester is
  19. present */
  20. typedef int gadgevent(struct Gadget *gadg, ULONG class, struct Requester *req,
  21. struct graph *g);
  22.  
  23. /* All possible commands */
  24. enum commands {none, reqgone, /* internal */
  25.                close, /* window closed */
  26.                /* menu functions */
  27.                _new_graph, _load_graph, _save_graph, print_graph, iff_graph, lo
  28. ad_vars, save_vars, quit,
  29.                limits, axes, zoom, zoom_out, center,
  30.                add_function, add_label,
  31.                edit, improve, del_object, edit_vars
  32.               };
  33.  
  34. /* Description of selected command, union depends on command */
  35. struct cmd {
  36.     enum commands command;
  37.     struct graph *g;
  38.     union {
  39.         struct function *f;
  40.         struct object *o;
  41.         double zoom_out;
  42.         struct {
  43.             double x0, y0, x1, y1;
  44.         } zoom_in;
  45.         struct {
  46.             double x, y;
  47.         } pt;
  48.     } data;
  49. };
  50.  
  51. extern tlist flist;                 /* List of available font names */
  52.  
  53. int make_font_list(void);           /* (Re)make flist */
  54. char *addfont(char *fname);         /* Add/Remove ".font" from font names */
  55. char *remfont(char *fname);
  56.  
  57. /* Display requester(in graph g), wait for it to leave */
  58. /* handle will be called for every gadget event */
  59. int DoRequest(struct Requester *r, struct graph *g, gadgevent *handle);
  60. /* The default gadget handler (switches between text gadgets) */
  61. int std_ghandler(struct Gadget *gg, ULONG class, struct Requester *req, struct
  62. graph *g);
  63. int getfile(char *file, char *msg);                          /* File requester
  64. */
  65. struct Requester *abort_request(struct graph *g, char *msg); /* Setup an abort
  66. requester */
  67. void set_abort_msg(struct Requester *req, char *msg);        /* Change abort ms
  68. g */
  69. void end_abort_request(struct Requester *req);               /* Clear abort req
  70.  */
  71. int aborted(struct Requester *req);                          /* Did user abort
  72. ? */
  73. void message(struct graph *g, ...);                          /* Display a messa
  74. ge (in a graph) */
  75. void alert(struct Window *win, char *msg1, char *msg2);      /* Use when no gra
  76. ph available */
  77. void nomem(struct Window *win);                              /* Standard no mem
  78. ory alert */
  79.  
  80. struct cmd next_command(void);      /* Return next selected command */
  81.  
  82. /* String utility functions, convert numbers to strings */
  83. char *double2str(char *to, double x);
  84. double str2double(char *from);
  85. char *int2str(char *to, int x);
  86. int str2int(char *from);
  87. char *strip(char *name);            /* Strip leading & trailing blanks */
  88.  
  89. /* Enable/Disable various menus */
  90. void disable_rect_menus(struct graph *g);   /* Menus for 'pos' object */
  91. void enable_rect_menus(struct graph *g);
  92. void disable_object_menus(struct graph *g); /* For selected objects */
  93. void enable_object_menus(struct graph *g);
  94.  
  95. int init_user(void);
  96. void cleanup_user(void);
  97. int init_uio(struct graph *g);      /* Setup/Cleanup interface for each graph *
  98. /
  99. void cleanup_uio(struct graph *g);
  100.  
  101. #endif
  102.  
  103.